<!--
 * @Author: HeAo
 * @Date: 2021-10-15 16:05:12
 * @LastEditTime: 2021-10-15 16:31:51
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \web2103-2105\web2103code\3-2-Vue\day07\4-axios-简写.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/axios.js"></script>
  <script src="../js/qs.js"></script>
  <script>
    const qs = Qs
    const baseUrl = 'http://47.94.46.113:8888'
    const queryData = {
      page: 1,
      pageSize: 10
    }
    const loginData = {
      username: 'admin1',
      password: 123321
    }
    const applyData = {
      name: 'tom',
      age: 12,
      telephone: 13455667788,
      gender: 'male'
    }

    axios.defaults.baseURL = 'http://47.94.46.113:8888'
    axios.defaults.headers.common['auth'] = 'zhangsan'
    axios.defaults.headers.post['Authorization'] = 'token'

    axios.get('/index/category/findAll', {
      params: {
        page: 1,
        pageSize: 10
      }
    }).then(res => {
      console.log(res.data.data);
    })

    axios.post(
      '/user/login',
      loginData
    ).then(res => {
      console.log(res.data.data.token);
    })
  </script>
</head>

<body>

</body>

</html>